#include "bossattack.h"
#include "config.h"

bossattack::bossattack()
{
    //加载月刃资源
    m_bossattack.load(BOSS_ATTACK_PATH);

    //月刃位置
    m_X=GAME_WIDTH;
    m_Y=0;

    //月刃状态
    m_Free=true;

    //月刃速度
    m_speed=BOSS_ATTACK_SPEED;

    //月刃发射间隔
    m_interval=BOSS_ATTACK_INTERVAL;

    //月刃边框
    m_Rect.setWidth(m_bossattack.width());
    m_Rect.setHeight(m_bossattack.height());
    m_Rect.moveTo(m_X,m_Y);
}

void bossattack::updatePosition()
{
    //空闲光波不计算坐标
    if(m_Free)
        return;
    //不空闲的光波向左移动
    m_X-=m_speed;
    m_Rect.moveTo(m_X,m_Y);
    //光波到左边界
    if(m_X<=-m_Rect.width())
    {
        m_Free=true;//重置空闲状态
    }
}
